<template>
    <div class="content-container">
        <Title :icon="'chat-poll-fill'" :title="'各平台问题占比'"></Title>
        <div class="h-290px overflow-hidden ml-16px mr-16px">
            <table class="distillation-table">
                <tr>
                    <th width="50%">平台</th>
                    <th width="25%">占比</th>
                    <th width="25%">数量</th>
                </tr>
            </table>
            <el-scrollbar :always="true">
                <table class="distillation-table">
                    <tr v-for="(row, index) in state.problemData" :key="index">
                        <td width="50%">{{ row.Name }}</td>
                        <td width="25%">{{ row.Proportion }}</td>
                        <td width="25%">{{ row.Value }}</td>
                    </tr>
                </table>
            </el-scrollbar>
        </div>
    </div>
</template>

<script setup lang="ts">
import Title from '@/components/Title/index.vue'
import { getPlatformQuestionApi } from '@/api/geoBasic/index'
import { IProblem } from '@/api/geo/types'

const route = useRoute()

const state = reactive({
    problemData: <IProblem[]>[]
})

async function getPlatformQuestion(id:any){
    const res:ResType = await getPlatformQuestionApi("/GEOBasicCustomerApi/GetKeywordProportion",{
        skip:id
    })
    if(res.code === 200){
        state.problemData = res.data
    }  
}

onMounted(() => {
    const { skip } = route.query
    getPlatformQuestion(skip)
})
</script>

<style scoped>

</style>